package com.orange.cetback.controller.user;

import com.orange.cetback.common.vo.Result;
import com.orange.cetback.pojo.dto.StudyWordDTO;
import com.orange.cetback.pojo.entity.UserWordReview;
import com.orange.cetback.pojo.vo.ReviewWordVO;
import com.orange.cetback.service.UserWordReviewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 基于遗忘曲线的单词复习表 前端控制器
 * </p>
 *
 * @author chenenjun
 * @since 2025-03-01
 */
@Tag(name = "用户单词复习接口")
@Slf4j
@RestController
@RequestMapping("/userApi/userWordReview")
public class UserWordReviewController {
    @Autowired
    private UserWordReviewService userWordReviewService;

    @Operation(summary = "提交背诵单词")
    @PostMapping("/submit")
    public Result<List<ReviewWordVO>> submitStudyWord(@RequestBody List<StudyWordDTO> studyWordDTOS){
        log.info("提交背诵单词:{}", studyWordDTOS);
        List<ReviewWordVO> reviewWordVOS = userWordReviewService.submitStudyWord(studyWordDTOS);
        return Result.success(reviewWordVOS);
    }
}
